package com.example.icampusevent;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.SimpleAdapter;

public class Events extends ListActivity{
	static final ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		SimpleAdapter adapter = new SimpleAdapter(
		this,
		list,
		R.layout.list_item,
		new String[] {"pen","price"},
		new int[] {R.id.label,R.id.sumary}
		);
		populateList();
		setListAdapter(adapter);
	 }
//		  @Override
//	  protected void onListItemClick(ListView l, View v, int position, long id) {
//	    String item = (String) getListAdapter().getItem(position);
//	    Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();
//	  }
//		  
	  private void populateList() {
			  HashMap<String,String> temp = new HashMap<String,String>();
			  temp.put("pen","Gameloft semina");
			  temp.put("price", "Loc: 301B1 Dur: 45m");
				  list.add(temp);
			  HashMap<String,String> temp1 = new HashMap<String,String>();
			  temp1.put("pen","VNG Semina");
			  temp1.put("price", "Loc: 305B1 Dur: 90m");
			  list.add(temp1);
			  HashMap<String,String> temp2 = new HashMap<String,String>();
			  temp2.put("pen","Music Concert");
			  temp2.put("price", "Loc: 203C5 Dur: 60m");
			  list.add(temp2);
			  HashMap<String,String> temp3 = new HashMap<String,String>();
			  temp3.put("pen","Android course");
			  temp3.put("price", "Loc: 302B4 Dur: 20m");
			  list.add(temp3);
			  HashMap<String,String> temp4 = new HashMap<String,String>();
			  temp4.put("pen","Porsche Design");
			  temp4.put("price", "Loc: 301B1 Dur: 50m");
			  list.add(temp4);
	 }
	  
		@Override
		public boolean onCreateOptionsMenu(Menu menu) {
			MenuInflater inflater = getMenuInflater();
			inflater.inflate(R.layout.menu, menu);
			return true;
		}

		@Override
		public boolean onOptionsItemSelected(MenuItem item) {
			// Handle item selection
			switch (item.getItemId()) {
			case R.id.map_search:
				return true;
			case R.id.map_refresh:
				return true;
			default:
				return super.onOptionsItemSelected(item);
			}
		}
}


